﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IHISCETeim.Web.MachineSys.SysBasic
{
    public partial class SvrController : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //System.Web.HttpRuntime.Cache.
            //LoadDate();
        }

        private void LoadDate()
        {
            ServiceController SAPSyncSvr = new ServiceController("IHISCETeim.SAPSyncSvr");
            string state = SAPSyncSvr.Status.ToString();
            tbSAPSyncSvrName.Text = SAPSyncSvr.ServiceName;

            switch (state)
            {
                case "Stopped":
                    tbSAPSyncSvrState.Text = "服务已停止";
                   // btnRestart.Enabled = false;
                   // btnStart.Enabled = true;
                    //btnStop.Enabled = false;
                    break;
                case "Running":
                    tbSAPSyncSvrState.Text = "服务运行中";
                    //btnStart.Enabled = false;
                   // btnRestart.Enabled = true;
                    break;
                /* 以下服务状态仅供参考，除非服务启动很慢，一般不需进行如下设置
                case "Paused":
                    lblState.Text = "服务已暂停";
                    break;
                case "StartPending":
                    lblState.Text = "服务正在启动";
                    break;
                case "StopPending":
                    lblState.Text = "服务正在停止";
                    break;
                case "ContinuePending":
                    lblState.Text = "服务即将继续";
                    break;
                case "PausePending":
                    lblState.Text = "服务即将暂停";
                    break;
                 * */
            }
        }
    }
}